<?php

namespace app\http\middleware;

class CheckLogin
{
    protected $wihte = ['Register', 'Login'];

    public function handle($request, \Closure $next)
    {
        if(!in_array($request->controller(), $this->wihte)){
            $user = model('member')->where('memb_id', session('user.id'))->find();
            if(!session('?user') || empty($user) || $user->memb_black) {
                return redirect('login');
            }
        }
        return $next($request);
    }
}
